import request from '@/utils/request'
import config from '@/utils/config'
import { splitStr } from '@/api/common'

// 分页查询角色信息
export function getRoleList(params) {
  return request({
    url: config.BaseUrl + '/server/role/query',
    method: 'get',
    params: splitStr(params)
  })
}

// 新增角色信息
export function addRole(params) {
  return request({
    url: config.BaseUrl + '/server/role/add',
    method: 'post',
    data: params
  })
}

// 编辑系统用户信息
export function editRole(params) {
  return request({
    url: config.BaseUrl + '/server/role/edit',
    method: 'post',
    data: params
  })
}

// 绑定角色权限
export function bindRole(params) {
  return request({
    url: config.BaseUrl + '/server/rolePermission/bind',
    method: 'post',
    data: params
  })
}

// 查询角色权限
export function rolePermission(params) {
  return request({
    url: config.BaseUrl + '/server/rolePermission/query',
    method: 'get',
    params: splitStr(params)
  })
}

// 获取角色名称
export function getRoleName(params) {
  return request({
    url: config.BaseUrl + '/server/user/info',
    method: 'get',
    params: splitStr(params)
  })
}
